/*
 * Copyright (C) 2020 The LINN Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package com.juqimiao.linn.transfer.query;

/**
 * 表示执行数据检索中的排序条件的类。
 * <p>
 *   比如：进行数据库检索的时候 SELECT * FROM [Table Name] ORDER BY [columnName ASC]， ORDER BY子句后面的条件。
 * </p>
 *
 * @author Collin Cai
 */
public class SortingCriteria implements CriteriaI {

    private static final long serialVersionUID = 5233782938470098721L;

    private String columnName;
    private OrderType orderType;

    /**
     * 默认构造器。
     */
    public SortingCriteria() {
    }

    /**
     * 提供相关ColumnName和OrderType进行实例构造。
     *
     * @param columnName 列名。
     * @param orderType  排序方式。
     */
    public SortingCriteria(String columnName, OrderType orderType) {
        this.columnName = columnName;
        this.orderType = orderType;
    }

    /**
     * 获取参与排序的列名。
     *
     * @return 列名。
     */
    public String getColumnName() {
        return columnName;
    }

    /**
     * 设置参与排序的列名
     *
     * @param columnName 列名。
     */
    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    /**
     * 获取排序是方式。
     *
     * @return OrderType类型。
     */
    public OrderType getOrderType() {
        return orderType;
    }

    /**
     * 设置排序是方式。
     *
     * @param orderType OrderType类型。
     */
    public void setOrderType(OrderType orderType) {
        this.orderType = orderType;
    }
}
